
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>消息</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link href="/css/css_likeHistory.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="../js/checkLogin.js"></script>
</head>
<body>
<script>
    $(function () {
        var authorId = JSON.parse(sessionStorage.getItem("user")).id;

        var currentPage = 1;//当前页
        var pages;//总页数
        var travelData=[];//定义一个数组用来接收每次分页时的数据
        function query() {//记得传递当前页这个参数
            $.get(baseUrl+"users/"+authorId+"/informations",{currentPage:currentPage,pageSize:10, type:6},function (data) {
                $.merge(travelData,data.list);
                var json = {
                    list: travelData
                };
                $(".userGood").renderValues(json,{
                    getHref:function (item,value) {
                        var url = $(item).data("href");
                        $(item).attr("href",url+value);
                    },
                    getText:function (item, value) {
                        $(item).html("评论:"+value);
                    }
                });
                pages = data.pages;
            });
            currentPage ++;
        }
        //默认查询第一页
        query();
        $.ajax({
            url:baseUrl+"users/"+authorId+"/informations",
            type:"put",
            data:{type:6},
            success:function (data) {
                console.log(data);
            }
        });
        //监听滚动事件,当滚动条发生变化时触发
        $(window).scroll(function(){
            //document滚上去的高度+手机窗口的高度 >= 整个文档的高度
            if (($(document).scrollTop()+$(window).height()) >= $(document).height()-1){
                if (currentPage <= pages){//如果当前页数小于等于总页数
                    query();
                }else {
                    $(document).dialog({
                        type : 'notice',
                        content: '<span class="info-text">我是有底线的!</span>',
                        autoClose: 1000,
                        position: 'bottom'
                    });
                }
            }
        });
    });
</script>
<section class="aui-flexView">
    <header class="aui-navBar aui-navBar-fixed b-line">
        <a href="/mine/profiles.html" class="aui-navBar-item">
            <i class="icon icon-return"></i>
        </a>
        <div class="aui-center">
            <span class="aui-center-title">评论我的</span>
        </div>
        <a href="javascript:;" class="aui-navBar-item">
        </a>
    </header>
    <section class="aui-scrollView userGood">
        <div class="aui-list-box" render-loop="list">
            <div class="aui-flex">
                <a data-href="/userProfiles.html?id=" render-key="list.id" render-fun="getHref">
                    <div class="aui-flex-logo">
                        <img render-src="list.headImgUrl" alt="">
                    </div>
                </a>
                <div class="aui-flex-box">
                    <h2>
                        <span render-html="list.nickName"></span>
                        <span style="font-size: 12px" render-fun="getText" render-key="list.title"></span>
                    </h2>
                    <h3 render-html="list.inforContent"></h3>
                </div>

                </span>
            </div>
        </div>
    </section>
</section>
</body>
</html>